<template>
  <div class="inProgress">
    <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
      <vocation-list
        v-for="(item,index) in list"
        :key="index"
        :visibleSlide="visibleSlide"
        :data="item"
        @link="link_bank"
        @refresh="refresh"
      ></vocation-list>
    </van-list>
  </div>
</template>

<script>
import vocationList from "base/vocationList/vocationList";

export default {
  components: { vocationList },
  data() {
    return {
      pageNum: 1,
      pageSize: 10,
      list: [],
      loading: false,
      finished: false,
      visibleSlide: true, // 显示停招
      zpxx: []
    };
  },
  created() {},
  methods: {
    onLoad() {
      // 异步更新数据
      this.$http({
        url: "/dwgl/zplbCx",
        method: "get",
        params: {
          pageNum: this.pageNum,
          pageSize: this.pageSize,
          czlx: 1
        }
      }).then(res => {
        // 加载状态结束
        this.loading = false;
        this.finished = false;
        let data = res.returnData;
        if (+data.executeResult == 1) {
          this.pageNum++;
          this.list.push(...data.zplb);
          if (this.pageNum > res.pageCount) {
            // 数据加载完毕
            this.finished = true;
          }
        } else {
          this.finished = true;
        }
      });
    },
    link_bank(zpgwid) {
      this.$router.push({
        path: "/vocation/jobDetail",
        query: { zpgwid: zpgwid }
      });
    },
    refresh(num) {
      if (num == 0) { // 停招 需要重新调用父组件的个数方法
        this.$parent.init();
      }
      this.pageNum = 1;
      this.list = [];
      this.onLoad();
    }
  }
};
</script>

<style lang="scss" scoped>
</style>
